A key feature of some modern programming languages such as Java is its garbage-collection process. Such a process takes care of releasing dynamically allocated memory that is no longer referenced. Because the heap is garbage-collected, programmers don't have to directly release allocated memory.
The name garbage collection implies that objects that are no longer needed by the program are “garbage” and can be thrown away. A more precise characterization might be recycling memory. In this manner, when an object is no longer referenced by the program, it may be recycled for further use as another object. The garbage collector must somehow determine which objects are no longer referenced by the program and make available the heap space occupied by such un-referenced objects.
Historically a single thread is used to perform garbage collection. When one thread performs garbage collection, there can be pauses or long waits while the collection is performed. In order to reduce the amount of time that a program pauses while garbage collection is performed, a plurality of thread may perform garbage collection to distribute the garbage collection work load. Concurrent garbage collection trades processor resources (which would otherwise be available to the application) for shorter collection pause times. Typically on an N processor system when the concurrent part of the collection is running, it will be using 1/Nth of the available processor power. On a uni-processor machine it would be fortuitous if it provided any advantage. The concurrent garbage collector also has some additional overhead costs that will take away from the throughput of the applications, such as the synchronization required between garbage collection threads. On a two processor machine there is a processor available for application threads while the concurrent part of the collection is running, so running the concurrent garbage collector thread does not “pause” the application. There may be reduced pause times as intended for the concurrent collector but again less processor resources are available to the application and some slowdown of the application should be expected.
Garbage collection may use several different methods to locate the objects to be processed. One such method is mark and sweep. Marking involves determining all the currently live (e.g. referenced) objects. Sweeping is the returning to the heap those objects which are no longer references on the stack or by other objects which are in turn referenced by some root object or the stack.